#include "Queen.h"

#include "SquareValueBoard.h"

#include "Bishop.h"
#include "Rook.h"

using namespace Rorn::Chess::TheCorruptRook;

Queen::Queen(void)
{
}

Queen::~Queen(void)
{
}

/*static*/ double Queen::CalculateScore(const Position& position, Player::Type player, const Square& square)
{
	double materialScore = 9.0;

	std::vector<Square> visibleAttackSquares;
	GetVisibleAttackSquares(position, player, square, visibleAttackSquares);
	double visibilityScore = 0;
	for(std::vector<Square>::const_iterator sqaureIter = visibleAttackSquares.begin() ; sqaureIter != visibleAttackSquares.end() ; ++sqaureIter)
		visibilityScore += SquareValueBoard::GetSquareValue(*sqaureIter);

	return materialScore + visibilityScore;
}

/*static*/ void Queen::GetLegalMoves(const Position& position, Player::Type player, const Square& startSquare, std::vector<MoveTreeNode>& legalMoves, int depth)
{
	// Slightly odd, maybe we should have GetAllLateralMoves() or sumpin'?
	Bishop::GetLegalMoves(position, player, startSquare, legalMoves, depth);
	Rook::GetLegalMoves(position, player, startSquare, legalMoves, depth);
}

/*static*/ void Queen::GetVisibleAttackSquares(const Position& position, Player::Type player, const Square& square, std::vector<Square>& visibleAttackSquares)
{
	// Slightly odd, maybe we should have GetAllLateralMoves() or sumpin'?
	Bishop::GetVisibleAttackSquares(position, player, square, visibleAttackSquares);
	Rook::GetVisibleAttackSquares(position, player, square, visibleAttackSquares);
}